

import request from '@/request/request';
import requestMock from '@/request/requestMock';

// 1.请求三级分类列表
export const reqCategoryList = ()=>{
    return request.get(`/product/getBaseCategoryList`)
}

//2. 请求banner的列表(MOCK请求)
export const reqBannerList = ()=>{
    return requestMock.get('/banner/list') ;
}

//2. 请求floor的列表(MOCK请求)
export const reqFloorList=()=>{
    return requestMock.get('/floor/list');
}

// 4. 请求搜索页面数据
export const reqSearchList = (searchParams)=>{
    return request.post('/list',searchParams)
};

// 5. 请求详情页面
export const reqDetailInfo = (skuId) => {
    return request.get(`/item/${skuId}`);
  };

// 6. 添加购物车或者修改购物车商品数量
export const reqAddCartSuccess = (skuId, skuNum)=>{
    return request.post(`/cart/addToCart/${skuId}/${skuNum}`);
}  

// 7.购物车页面数据
export const reqShopCartList = ()=>{
    return request.get(`/cart/cartList`)
}

// 8. 购物车修改数据
export const reqCheckCart = (skuID,isChecked)=>{
    return request.get(`/cart/checkCart/${skuID}/${isChecked}`)
}

// 9.删除购物车某个商品数据
export const reqDelCart = (skuId) =>{
    return  request.delete(`/cart/deleteCart/${skuId}`)
}

//10.控制购物车所有商品的状态
export const reqAllChecked = (isChecked,skuIdList)=>{
    return request.post(`/cart/batchCheckCart/${isChecked}`,skuIdList)
}

// 11.批量删除购物车数据
export const reqDeleteAll = (skuIdList)=>{
    return request.delete(`/cart/batchCheckCart/`,{data:skuIdList})
}

// 12 获取注册验证码
export const reqVerifyCode = (phone)=>{
    return request.get(`/user/passport/sendCode/${phone}`);
}

// 13. 注册请求
export const reqRegister =(userInfo)=>{
    return  request.post(`/user/passport/register`, userInfo)
}

// 14请求登录
export const reqLogin = (userInfo) =>{
    return request.post(`/user/passport/login`, userInfo)
};

// 15.请求用户信息
export const reqUserInfo=()=>{
    return request.get(`/user/passport/auth/getUserInfo`)
}

// 16. 退出登录
export const reqLogout =()=>{
    return request.get(`/user/passport/logout`)
}

// 17.请求用户地址
export const reqUserAddress =()=>{
    return requestMock.get(`/address/list`)
}

// 18.请求交易信息
export const reqTradeInfo =()=>{
    return request.get(`/order/auth/trade`);
}

// 19.提交订单信息
export const reqSubmitOrder =(tradeNo, orderInfo) =>{
    return request.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, orderInfo)
}

//20.获取支付详情
export const reqPayInfo = (orderId) => {
    return request.get(`/payment/weixin/createNative/${orderId}`);
  };

// 21. 获取支付成功的信息
export const reqPayStatus =(orderId)=>{
    return request.get(`/payment/weixin/queryPayStatus/${orderId}`);
}  

// 22. 获取订单的分页列表
export const reqOrderLIst = (page,limit)=>{
    return request.get(`/order/auth/${page}/${limit}`);
}

